<script setup lang="ts">
import logo from "@/components/logo/index.vue"
import SvgIcon from "@/components/svg-icon/index.vue";
import {useUserInfoStore} from "@/stores/user_info";
import {useRouter} from "vue-router";

const userInfoStore = useUserInfoStore()

const router = useRouter()
const toLogin = () => {
  router.push('/login?redirect=' + router.currentRoute.value.path)
}
</script>

<template>
  <div class="external-sharing">
    <div class="header">
      <logo></logo>
      <div v-if="userInfoStore.token" class="header-name">
        <h4>浪漫写尽歌谱</h4>
        <svg-icon name="pull"/>
        <div class="home" @click="$router.push('/')">
          <h3>我的云盘</h3>
        </div>
      </div>
      <div @click="toLogin" v-else class="header-name">
        <h4>去登录</h4>
      </div>
    </div>
    <div class="content">
      <router-view></router-view>
    </div>
  </div>
</template>

<style scoped lang="scss">
.external-sharing {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #fff;

  .header {
    position: relative;
    min-width: 1600px;
    height: 90px;
    width: 100vw;
    display: flex;
    align-items: center;
    padding: 0 70px;
    justify-content: space-between;
    //padding: 0 70px;
    background-color: #fff;
    box-shadow: 1px 2px 4px #d9d9d9;

    .header-name {
      display: flex;
      align-items: center;
      cursor: pointer;
      gap: 5px;
      height: 100%;
    }

    .header-name:hover .home {
      display: block;
    }

    .home {
      display: none;
      text-align: center;
      width: 150px;
      background-color: white;
      padding: 15px;
      box-shadow: 1px 2px 4px #d9d9d9;
      position: absolute;
      right: 50px;
      top: 70px;
      cursor: pointer;
    }

    .home:hover {
      background-color: #F5F5F5;
    }

  }

  .content {
    flex: 1;
  }
}
</style>